Dynomotion

Group: DynoMotion Message: 15166 From: Hardy Family Date: 11/15/2017
Subject: Flash recovery, how does it work?
Hi Tom,

I programmed a bad supervisor thread into the kflop (broke my own rule about testing before flashing), and it won't boot/power up properly, so I need to reset/recover the firmware.  I can hopefully do this with the KMotion utility, but I would like to integrate this with our Linux app.  So how does the recovery work?  Is there a magic command that prevents it from running any threads at the start? 

Regards,
SJH

Group: DynoMotion Message: 15167 From: Hardy Family Date: 11/15/2017
Subject: Re: Flash recovery, how does it work?
Follow up: I seem to have bricked the kflop.  KMotion.exe says that it times out connecting to the device.  Tried it many times, with 2 different laptops.  Is that even possible with a bad user program?  I guess so, since it happened.  Anything else I can try to recover?


On Wed, Nov 15, 2017 at 9:49 PM, Hardy Family <hardy.woodland.cypress@...> wrote:
Hi Tom,

I programmed a bad supervisor thread into the kflop (broke my own rule about testing before flashing), and it won't boot/power up properly, so I need to reset/recover the firmware.  I can hopefully do this with the KMotion utility, but I would like to integrate this with our Linux app.  So how does the recovery work?  Is there a magic command that prevents it from running any threads at the start? 

Regards,
SJH


Group: DynoMotion Message: 15169 From: Tom Kerekes Date: 11/16/2017
Subject: Re: Flash recovery, how does it work?
Hi SJH,

KFLOP has a Bootloader Program that boots first that is capable of communicating with the PC.  It also flashes the LED's for ~3sec waiting for a special command from the PC (ESC B).   If received it remains in the bootloader and can accept a Firmware download from the PC to memory (not Flash).  The Bootloader responds with a byte of 0x03. After downloading the firmware the PC then sends a command to tell the bootloader to jump to some address (0x0000000C) to startup the main firmware.

The code below is used to do this from a Windows worker Thread.  In parallel the GUI in the Config Flash Dialog displays a wait dialog box.  The KMotionLockRecovery() basically connects to KFLOP when it becomes available without sending any special commands.

HTH
Regards
TK

DWORD RecoveryShell(LPDWORD lpdwParam)
{
    int result;

    CString response;

    CString *s = (CString *)lpdwParam;

    do
    {
        result = TheFrame->KMotionDLL->KMotionLockRecovery();
    }
    while (result != KMOTION_LOCKED && !TheFrame->ConfigDlg.TerminateRecovery);

    if (TheFrame->ConfigDlg.TerminateRecovery) return 1;

    TheFrame->KMotionDLL->ReleaseToken();

    TheFrame->ConfigDlg.WaitDlg.Terminate=true;  // we are connected terminate wait dialog

    if (TheFrame->KMotionDLL->WriteLineWithEcho("\x1b""B")) return 1;  // WithEcho doesn't prepend anything
    if (TheFrame->KMotionDLL->ReadLineTimeOut(response.GetBuffer(MAX_LINE),5000)) return 1; 
    response.ReleaseBuffer();

    if (response != "\x03\r\n") return 1;

    if (TheFrame->KMotionDLL->LoadCoff(-1, *s, 2)) return 1;

    if (TheFrame->m_KFLOP)
    {
        if (TheFrame->KMotionDLL->WriteLine("JUMP 10000010")) return 1;  // App entry point hex 0x10000010
    }
    else
    {
        if (TheFrame->KMotionDLL->WriteLine("JUMP C")) return 1;  // App entry point hex 0xC
    }
    return 0;
}

On 11/15/2017 9:49 PM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
 
Hi Tom,

I programmed a bad supervisor thread into the kflop (broke my own rule about testing before flashing), and it won't boot/power up properly, so I need to reset/recover the firmware.  I can hopefully do this with the KMotion utility, but I would like to integrate this with our Linux app.  So how does the recovery work?  Is there a magic command that prevents it from running any threads at the start? 

Regards,
SJH


Group: DynoMotion Message: 15170 From: Tom Kerekes Date: 11/16/2017
Subject: Re: Flash recovery, how does it work?
Hi SJH,

Are you performing the recovery correctly?  I would expect a different error message if you were.  See:

http://dynomotion.com/Help/ConfigurationScreen/ConfigurationScreen.htm#FLASH

Regards
TK

On 11/15/2017 10:51 PM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
 
Follow up: I seem to have bricked the kflop.  KMotion.exe says that it times out connecting to the device.  Tried it many times, with 2 different laptops.  Is that even possible with a bad user program?  I guess so, since it happened.  Anything else I can try to recover?


On Wed, Nov 15, 2017 at 9:49 PM, Hardy Family <hardy.woodland.cypress@...> wrote:
Hi Tom,

I programmed a bad supervisor thread into the kflop (broke my own rule about testing before flashing), and it won't boot/power up properly, so I need to reset/recover the firmware.  I can hopefully do this with the KMotion utility, but I would like to integrate this with our Linux app.  So how does the recovery work?  Is there a magic command that prevents it from running any threads at the start? 

Regards,
SJH



Group: DynoMotion Message: 15171 From: Hardy Family Date: 11/16/2017
Subject: Re: Flash recovery, how does it work?
Sorry about the email flood.  Anyway, I managed to resurrect the kflop.  Maybe the usb cable was dodgy, but eventually it worked for long enough for me to uncheck the 'run thread' button and reflash.  But the original question still stands.

Regards,
SJH


On Wed, Nov 15, 2017 at 10:51 PM, Hardy Family <hardy.woodland.cypress@...> wrote:
Follow up: I seem to have bricked the kflop.  KMotion.exe says that it times out connecting to the device.  Tried it many times, with 2 different laptops.  Is that even possible with a bad user program?  I guess so, since it happened.  Anything else I can try to recover?


On Wed, Nov 15, 2017 at 9:49 PM, Hardy Family <hardy.woodland.cypress@gmail. com> wrote:
Hi Tom,

I programmed a bad supervisor thread into the kflop (broke my own rule about testing before flashing), and it won't boot/power up properly, so I need to reset/recover the firmware.  I can hopefully do this with the KMotion utility, but I would like to integrate this with our Linux app.  So how does the recovery work?  Is there a magic command that prevents it from running any threads at the start? 

Regards,
SJH